package com.example.demo.common;

import lombok.Data;

@Data
public class Result implements java.io.Serializable {
    private int code;
    private String msg;
    private Object data;
    public Result(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public static Result success() {
        return new Result(200, "success");
    }
    public static Result success(Object data) {
        Result result = new Result(200, "success");
        result.setData(data);
        return result;
    }

    public static Result fail(String msg,Object data) {
        Result result = new Result(400, msg);
        result.setData(data);
        return result;
    }
}
